package com.zkdcloud.repository;

import com.zkdcloud.domain.PhoneCode;
import org.jfaster.mango.annotation.DB;
import org.jfaster.mango.annotation.SQL;
import org.springframework.stereotype.Repository;

/**
 * @author zk123
 * @version 2018/6/2
 */
@DB(table = "phoneCode")
@Repository
public interface PhoneCodeDao {
    String COLUMNS = "id,mobile,code,create_time";

    @SQL("insert into #table("+COLUMNS+") values(:id,:mobile,:code,:createTime)")
    void add(PhoneCode phoneCode);

    @SQL("select * from #table where mobile = :1 order by create_time desc")
    PhoneCode getByMobile(String mobile);

    @SQL("delete from #table where mobile = :1")
    void removeByMoblie(String mobile);
}
